﻿Imports DataDynamics.ActiveReports 
Imports DataDynamics.ActiveReports.Document 

Public Class R030601

#Region "変数"

    ''' <summary>
    ''' ページフラグ
    ''' </summary>
    ''' <remarks></remarks>
    Private blnNewPage As Boolean = False

    Dim rowcounts As Integer = -1

    Dim rows As Integer = 0

#End Region

    Private Sub R030601_ReportStart(sender As Object, e As System.EventArgs) Handles Me.ReportStart
        Dim dt As DataTable
        dt = Me.DataSource
        rowcounts = dt.Rows.Count
        AllTotal1.Text = 0
        AllTotal2.Text = 0
        Alltotal3.Text = 0

        If rowcounts > 5 And rowcounts < 11 Then
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            Me.DataSource = dt
        End If

        Dim rest As Integer = 0
        Dim rowtemp As Integer = rowcounts - 10
        rest = rowtemp Mod 21
        If rest > 16 Then
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            dt.Rows.Add()
            Me.DataSource = dt
        End If

        rowcounts = dt.Rows.Count
    End Sub


    Private Sub R030601_PageStart(sender As Object, e As System.EventArgs) Handles Me.PageStart

        'test pass
        If rowcounts > 15 Then
            If rows > rowcounts - 15 Then

                PageFooter.Height = 2.883 / 2.54
            Else

                PageFooter.Height = 0.484 / 2.54
            End If
        End If


        If rowcounts < 16 Then

            If rowcounts < 6 Then


                PageFooter.Height = 2.883 / 2.54
            Else

                PageFooter.Height = 0.484 / 2.54
            End If

        End If
    End Sub

    Private Sub R030601_FetchData(sender As Object, eArgs As DataDynamics.ActiveReports.ActiveReport.FetchEventArgs) Handles Me.FetchData
        rows += 1
    End Sub

    Private Sub GroupHeader1_Format(sender As System.Object, e As System.EventArgs) Handles GroupHeader1.Format
        blnNewPage = True
    End Sub

    Private Sub GroupHeader2_Format(sender As System.Object, e As System.EventArgs) Handles GroupHeader2.Format
        If blnNewPage = True Then
            GroupHeader2.Height = 0
            blnNewPage = False
        End If
    End Sub

End Class
